Track channel lifecycle events#304
Merged
Merged
Conversation
Member
Author
|
STAFF ENGINEER REVIEW: APPROVED — Structural review clean. Verified lifecycle migration chain, parameterized readout SQL, Telethon admin-log high-water ingestion, diff-level secret scan, Alembic head, ruff, and targeted tests. Codex raised a P2 on admin-invite attribution, but Telethon's AdminLogEvent.new returns action.participant for ParticipantInvite, which this PR reads before falling back to event.user_id. |
Member
Author
|
|
Member
Author
|
✅ Approved + merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes FFM-1459.\n\n## Summary\n- adds channel_lifecycle_event storage with channel/event dedupe and Analyst-friendly indexes\n- extends the existing Telethon channel stats collector to ingest join/leave admin-log events using a high-water mark\n- documents the passive lifecycle daily readout query for Analyst\n\n## Verification\n- ruff check --fix src/ tests/\n- ruff format src/ tests/\n- DATABASE_URL=postgresql+asyncpg://app:app@app_db:5432/app pytest tests/flows/crossposting/test_channel_lifecycle.py\n\n## Notes\n- Does not alter recommendation weights or bot session flows.\n- Collection requires the existing Telethon session to have admin-log access to the channels.